#include <iostream>
#include <algorithm>

using namespace std;

typedef long long LL;

const int N = 1e5 + 10;

int T;
LL a[N];

LL gcd(LL a, LL b)
{
	return b == 0 ? a : gcd(b, a % b);
}

bool cmp(int a, int b)
{
	return a > b;
 } 

int main()
{
	cin >> T;
	while(T--)
	{
		int n; cin >> n;
		for(int i = 1; i <= n; i++) cin >> a[i];
		sort(a + 1, a + 1 + n);
		
		LL ret = a[2];
		bool flag = true;
		if(a[1] == ret) cout << "Yes" << endl;
		else
		{
			ret = 0;
			for(int i = 2; i <= n; i++)
			{
				if(a[i] % a[1] == 0) ret = gcd(ret, a[i]);
				if(ret == a[1])
				{
					cout << "Yes" << endl;
					flag = false;
					break;
				}
			}
			if(flag) cout << "No" << endl;
		}
		

	}
//	cout << gcd(0, 12) << endl;
	return 0;
}
